home *** CD-ROM | disk | FTP | other *** search
/ Aminet 19 / Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso / Aminet / comm / www / GetHistoryENG.lha / GetHistoryITA.ibrx < prev   
Text File  |  1997-04-23  |  4KB  |  143 lines

  1. /*
  2.   $VER: GetHISTORY 1.0 by Giuseppe Mammano
  3.   mammano@infoservizi.it
  4. */
  5. lf    = '0a'x
  6. cr    = '0d'x  
  7. file = 'globalhistory'         /*Modificare il PATH, se necessario... Inputfile*/
  8. tmpfile= 'ram:global.html'      /*Contiene la lista da caricare... OutputFile*/
  9.  
  10. if ~show('l','rexxreqtools.library') then 
  11.   if ~addlib('rexxreqtools.library',0,-30,0) then do
  12.     say "Couldn't find rexxreqtools.library"
  13.     exit
  14.   end
  15. options results
  16.  
  17. dat = date()
  18. parse var dat giorno mese anno
  19. dag = left(date('W', date(S), 'S'), 3)
  20. datum = dag mese giorno time() anno
  21.  
  22. salva=0
  23. if ~open(temp,file,'r') then call ERRORE1(file) else
  24. do
  25.   msg = readch(temp,2097152) /* max size = 2MB, aumentalo se necessario */
  26.   msg = translate(msg, 'hpt', 'HPT')                /* minuscolo */
  27.   check = pos('ttp://', msg)
  28.     if check = 0 then do
  29.       rtezrequest('Non trovo nessun URL.', '_Ok', 'GlobalHistory'),"rt_pubscrname=ibrowseBR")
  30.       exit
  31.     end
  32.   close(temp)
  33.   rtezrequest('Carico la GlobalHistory come pagina HTML?', '_Si|_No', 'GlobalHistory',"rt_pubscrname=ibrowseBR")
  34.   if rtresult == 1 then salva=1  
  35.   if check ~=0 then 
  36.   do
  37.    open(temp, file, 'r')
  38.    if salva==1 then CALL salvaHeader 
  39.    do while ~eof(temp)
  40.         msg = readln(temp)
  41.         msg = translate(msg, 'hpt', 'HPT')
  42.         parse var msg . 'ttp://' httpadres .
  43.         if httpadres ~= '' then 
  44.         do 
  45.           if right(httpadres,1) == '/' | right(httpadres,4)='html' | right(httpadres,3)='htm' then 
  46.          do 
  47.             lengte = length(httpadres)   
  48.             call filter(httpadres, lengte)
  49.             if salva == 1 then call salvaURL 
  50.             else
  51.              do
  52.               vraag = center(' Carico questo URL? ',lengte2,'-')
  53.               httpadres = rtgetstring(httpadres,vraag,'GlobalHistory','_Carica+Prossimo|Carica+_Smetti|P_rossimo|_Annulla',"rt_pubscrname=ibrowseBR")
  54.               if show('P','IBROWSE') then 
  55.              do
  56.              if rtresult == 1 | rtresult == 2 then 
  57.                  do 
  58.                   address 'IBROWSE'
  59.                   GOTOURL '"'httpadres'"'
  60.                  end /*primo*/
  61.                      else
  62.                      if rtresult == 2 | rtresult == 0 then exit
  63.              end /*secondo*/
  64.             end /*terzo*/
  65.          end /*quarto*/
  66.         end /*ciclo di lettura URL esce qui*/
  67.        end /*terzultimo*/
  68.    if rtresult == 0 then exit
  69.    end /*penultimo*/
  70.   close(temp)
  71.   if salva==1 then call SalvaCoda
  72.   rtezrequest('Lista terminata!', '_Ok', 'GLobalHistory',"rt_pubscrname=ibrowseBR")
  73.   if salva == 1 & show('P','IBROWSE') then 
  74.   do
  75.    address 'IBROWSE'
  76.    GOTOURL '"file:///'tmpfile'"'
  77.    call close(http)
  78.   end 
  79. exit
  80. end /*ultimo*/
  81.  
  82. filter:
  83.   adres = arg(1)
  84.   lngth = arg(2)
  85.  
  86.  
  87.   lnfd = pos(lf, adres)
  88.   if lnfd ~=0 then do
  89.     adres = delstr(adres, lnfd)
  90.   end
  91.   cret = pos(cr, adres)
  92.   if cret ~=0 then do
  93.     adres = delstr(adres, cret)
  94.   end
  95.   punt = lastpos('.', adres)
  96.   if punt ~=0 then lngth = length(adres)
  97.   if (punt = lngth) then do
  98.     adres = delstr(adres, punt)
  99.   end
  100.   haak = lastpos(')', adres)
  101.   if haak ~=0 then do
  102.     adres =  delstr(adres, haak)
  103.   end
  104.   komma = pos(',', adres)
  105.   if komma ~= 0 then do
  106.     adres = delstr(adres, komma)
  107.   end
  108.   quote = pos("'", adres)
  109.   if quote ~= 0 then do
  110.     adres = delstr(adres, quote)
  111.   end
  112.   dquote = pos('"', adres)
  113.   if dquote ~= 0 then do
  114.     adres = delstr(adres, dquote)
  115.   end
  116.   httpadres = 'http://'||adres
  117.   lengte2 = length(httpadres)
  118. return
  119.  
  120. ERRORE1:
  121. ARG file
  122. SAY 'Errore!!'
  123. SAY 'Non è possibile aprire il file 'file''
  124. EXIT
  125.  
  126. SalvaHeader:
  127. rtezrequest('Quest''operazione può durare qualche minuto: Continuo?', '_Si|_No', 'GlobalHistory',"rt_pubscrname=ibrowseBR")
  128. if rtresult == 1 then do
  129.   open(dummy,tmpfile,'w')
  130.   call writeln dummy,'<!-- IBrowse GlobalHistory 'datum' -->'cr'<HTML>'cr'<HEAD><TITLE>IBrowse Hotlist 'datum' </TITLE></HEAD>'cr'<BODY>'cr'<H2><P ALIGN=CENTER>IBrowse GlobalHistory</P></H2>'cr'<HR>'cr'<UL>'
  131.  end
  132. else salva=0
  133. return
  134.  
  135. SalvaURL:
  136. call writeln dummy,'<LI><A HREF="'httpadres'">'httpadres'</A>'  
  137. return
  138.  
  139. SalvaCoda:
  140. call writeln dummy,'<HR>'cr'<P align=center><font size=-1>This list has been created using <A HREF="http://www.omnipresence.com/IBrowse/">IBrowse 1.1</A>.</font></P></BODY>'cr'</HTML>'
  141. close(dummy)
  142. return
  143.